<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Open Social Templates</title>
	<script>
	
	function _IG_GetImage(url) {
		
		var img = document.createElement("img");
		//http://deploz.com/orkut/resources//btnInstaleTambem.gif
		img.src = url.substr(url.indexOf("resources"));
		return img;
	}
	
	function update() {
		var select = document.getElementById("templates");
		var surface = document.getElementById("surface");

		GLE__MODULE_ID__._surface = surface.value;
		
		var obj = document.getElementById("obj").value;
		var param = {};
		try {
			param = eval("param = " + obj);
		} catch( e ) {
			alert(e);
			return;
		}
		
		var f = select.value;
		if ( !f ) {
			return;
		}
		if ( typeof GLE__MODULE_ID__[f] == "function" ) {
			GLE__MODULE_ID__.setPage(GLE__MODULE_ID__[f](param), "__template");
		} else {
			alert(f + " don't exists.");
		}		
	}
	window.onload = function() {
		update();
	}
	</script>
	<style>
		#__template {border:1px solid #000;width:700px;}
		.__menu {background:#ccc;padding:10px;}
	</style>
	#HEAD#
</head>
<body>
	<div class="__menu">
		<select id="templates"  onchange="update()">
			<option></option>
			#SELECT#
		</select>
		<select id="surface" onchange="update()">
			<option>canvas</option>
			<option>profile</option>
		</select>
		<input type="text" id="obj" value="{}" />
		<input type="button" value="update" onclick="update()" />
	</div>
	<br />
	<div id="__template">
	</div>
</body>
</html>